﻿@model GameSchoolApplication.Models.StudentTestPoints

@{
    ViewBag.Title = "Gefa einkunn";
    Layout = "~/Views/Shared/_TeacherLayout.cshtml";
}

<h2>Gefa einkunn fyrir: @Model.Test.TestName</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

<ol class="test">
    @foreach (var answer in Model.StudentAnswers)
    { 
        <li>
            <p>@answer.Question.Content</p>
            @if (@answer.AnswerId == null)
            { 
                <p>Svar: @answer.AnswerText</p>
            }
            else
            { 
                <p>Svar: @answer.Answer.Content</p>
            }
        </li>
    }
</ol>
@if (Model.Points == null)
{
    using (Html.BeginForm()) {
        @Html.ValidationSummary(true)
        <fieldset>
            <legend></legend>

            @Html.HiddenFor(model => model.Id)
            @Html.HiddenFor(model => model.TestId)
            @Html.HiddenFor(model => model.StudentId)

            <div class="editor-label">
                @Html.LabelFor(model => model.Points) (Hámark: @Model.Test.MaxPoints) 
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Points)
                @Html.ValidationMessageFor(model => model.Points)
            </div>

            <p>
                <input type="submit" value="Staðfesta" />
            </p>
        </fieldset>
    }
}
else
{ 
    <p>Nemandi hefur fengið stigin: @Model.Points</p>
}
<div>
    @Html.ActionLink("Til baka í lista", "Scores", "Game")
</div>
